package world.liquor.domain;

import world.member.domain.Member;

/**
 * 맥주 평가 Domain Object
 *
 */
public class BeerAssessment {
	private int beerAssessmentId; //beerAssessment table id(pk)
	private String memberId; //평가한 회원 id
	private String beerInfoId; //평가된 맥주 id
	private int assessment; //평가점수
	private BeerInfo beer;
	private Member member;
	
	//생성자
	public BeerAssessment() {}
	
	public BeerAssessment(String memberId, String beerInfoId, int assessment) {
		super();
		this.memberId = memberId;
		this.beerInfoId = beerInfoId;
		this.assessment = assessment;
	}

	public BeerAssessment(int beerAssessmentId, String memberId,
			String beerInfoId, int assessment) {
		this.beerAssessmentId = beerAssessmentId;
		this.memberId = memberId;
		this.beerInfoId = beerInfoId;
		this.assessment = assessment;
	}
	
	public BeerAssessment(int beerAssessmentId, String memberId,
			String beerInfoId, int assessment, BeerInfo beer, Member member) {
		super();
		this.beerAssessmentId = beerAssessmentId;
		this.memberId = memberId;
		this.beerInfoId = beerInfoId;
		this.assessment = assessment;
		this.beer = beer;
		this.member = member;
	}

	//getter, setter
	public int getBeerAssessmentId() {
		return beerAssessmentId;
	}
	public void setBeerAssessmentId(int beerAssessmentId) {
		this.beerAssessmentId = beerAssessmentId;
	}
	public String getMemberId() {
		return memberId;
	}
	public void setMemberId(String memberId) {
		this.memberId = memberId;
	}
	public String getBeerInfoId() {
		return beerInfoId;
	}
	public void setBeerInfoId(String beerInfoId) {
		this.beerInfoId = beerInfoId;
	}
	public int getAssessment() {
		return assessment;
	}
	public void setAssessment(int assessment) {
		this.assessment = assessment;
	}
	
	public BeerInfo getBeer() {
		return beer;
	}

	public void setBeer(BeerInfo beer) {
		this.beer = beer;
	}

	public Member getMember() {
		return member;
	}

	public void setMember(Member member) {
		this.member = member;
	}

	@Override
	public String toString() {
		return "BeerAssessment [beerAssessmentId=" + beerAssessmentId
				+ ", memberId=" + memberId + ", beerInfoId=" + beerInfoId
				+ ", assessment=" + assessment + ", beer=" + beer + ", member="
				+ member + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + assessment;
		result = prime * result + ((beer == null) ? 0 : beer.hashCode());
		result = prime * result + beerAssessmentId;
		result = prime * result
				+ ((beerInfoId == null) ? 0 : beerInfoId.hashCode());
		result = prime * result + ((member == null) ? 0 : member.hashCode());
		result = prime * result
				+ ((memberId == null) ? 0 : memberId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BeerAssessment other = (BeerAssessment) obj;
		if (assessment != other.assessment)
			return false;
		if (beer == null) {
			if (other.beer != null)
				return false;
		} else if (!beer.equals(other.beer))
			return false;
		if (beerAssessmentId != other.beerAssessmentId)
			return false;
		if (beerInfoId == null) {
			if (other.beerInfoId != null)
				return false;
		} else if (!beerInfoId.equals(other.beerInfoId))
			return false;
		if (member == null) {
			if (other.member != null)
				return false;
		} else if (!member.equals(other.member))
			return false;
		if (memberId == null) {
			if (other.memberId != null)
				return false;
		} else if (!memberId.equals(other.memberId))
			return false;
		return true;
	}

	
	
	
	
	
}
